package com.hst.capacity.domain.model.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import java.io.Serializable;

/**
 *  带分页的检索入参
 *
 * @author Hans
 * */
@Data
public class PageParam implements Serializable  {

    private final static Integer DEFAULT_PAGE_INDEX = 1;
    private final static Integer DEFAULT_PAGE_SIZE = 10;

    /**
     *  页码，默认第1页。
     *
     * */
    @Min(value = 1, message = "页码最小值为 1")
    @JsonProperty("page")
    private Integer pageIndex = DEFAULT_PAGE_INDEX;

    /**
     *  每页条数,默认10条。
     *
     * */
    @Min(value = 1, message = "每页条数最小值为 1")
    @Max(value = 100, message = "每页条数最大值为 100")
    private Integer pageSize = DEFAULT_PAGE_SIZE;

}
